<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
  <!--<xs:include schemaLocation="isv.config.xsd" /> START-->
  <xs:element name="configuration" type="IsvConfigurationType" />
  <xs:complexType name="IsvConfigurationType">
    <xs:sequence>
      <xs:element name="Root">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="NavBarAreas" minOccurs="0" maxOccurs="1">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="NavBarArea" minOccurs="0" maxOccurs="unbounded">
                    <xs:complexType>
                      <xs:sequence>
                        <xs:element name="Titles" minOccurs="1" maxOccurs="1" type="LocalizedTitles" />
                      </xs:sequence>
                      <xs:attribute name="Id" type="xs:string" use="required" />
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
            <xs:element name="MenuBar" minOccurs="0" maxOccurs="1">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="CustomMenus" minOccurs="0" maxOccurs="1">
                    <xs:complexType>
                      <xs:sequence>
                        <xs:element name="Menu" minOccurs="0" maxOccurs="unbounded" type="Menu" />
                      </xs:sequence>
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
            <xs:element name="ToolBar" type="ToolBar" minOccurs="0" maxOccurs="1" />
            <xs:element name="Areas" minOccurs="0" maxOccurs="1">
              <xs:complexType>
                <xs:all>
                  <xs:element name="Home" type="NavigationArea" maxOccurs="1" minOccurs="0" />
                  <xs:element name="Workplace" type="NavigationArea" maxOccurs="1" minOccurs="0" />
                  <xs:element name="Sales" type="NavigationArea" maxOccurs="1" minOccurs="0" />
                  <xs:element name="Marketing" type="NavigationArea" maxOccurs="1" minOccurs="0" />
                  <xs:element name="Service" type="NavigationArea" maxOccurs="1" minOccurs="0" />
                  <xs:element name="Reports" type="NavigationArea" maxOccurs="1" minOccurs="0" />
                </xs:all>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="Entities" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="Entity" type="EntityNode" minOccurs="0" maxOccurs="unbounded" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="ServiceManagement" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="AppointmentBook" minOccurs="0" maxOccurs="1">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="SmoothScrollLimit" type="xs:integer" minOccurs="0" maxOccurs="1" />
                  <xs:element name="ValidationChunkSize" type="xs:integer" minOccurs="0" maxOccurs="1" />
                  <xs:element name="TimeBlocks" minOccurs="0" maxOccurs="1">
                    <xs:complexType>
                      <xs:sequence>
                        <xs:element name="TimeBlock" type="TimeBlockNode" minOccurs="0" maxOccurs="unbounded" />
                      </xs:sequence>
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="version" type="xs:string" use="required" />
  </xs:complexType>
  <!--
		A Timeblock definition
	-->
  <xs:complexType name="TimeBlockNode">
    <xs:attribute name="EntityType" type="xs:string" use="required" />
    <xs:attribute name="StatusCode" type="xs:string" use="required" />
    <xs:attribute name="CssClass" type="xs:string" use="required" />
    <xs:attribute name="Client" type="xs:string" use="optional" />
    <xs:attribute name="AvailableOffline" type="xs:boolean" use="optional" />
  </xs:complexType>
  <!--
		The Homepage Left Navigation Area
	-->
  <xs:complexType name="NavigationArea">
    <xs:sequence>
      <xs:element minOccurs="0" maxOccurs="unbounded" name="NavBarItem">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="Titles" minOccurs="1" maxOccurs="1" type="LocalizedTitles" />
          </xs:sequence>
          <xs:attribute name="Icon" type="xs:string" use="required" />
          <xs:attribute name="Url" type="xs:string" use="required" />
          <xs:attribute name="Id" type="xs:string" use="required" />
          <xs:attribute name="PassParams" type="CRM_Boolean" use="optional" />
          <xs:attribute name="Client" type="xs:string" use="optional" />
          <xs:attribute name="AvailableOffline" type="xs:boolean" use="optional" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="code" type="xs:string" use="required" />
  </xs:complexType>
  <!--
		A Menu that contains 1 or more Menu Items or Sub-Menus
	-->
  <xs:complexType name="Menu">
    <xs:sequence>
      <xs:element name="Titles" minOccurs="0" maxOccurs="1" type="LocalizedTitles" />
      <xs:group ref="MenuNodes" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="AccessKey" type="CRM_AccessKey" use="optional" />
    <xs:attribute name="ValidForCreate" type="CRM_Boolean" use="optional" />
    <xs:attribute name="ValidForUpdate" type="CRM_Boolean" use="optional" />
  </xs:complexType>
  <!--
		Valid nodes that may appear inside of a Menu
		This may appear in any order and may occur as many times as needed
	-->
  <xs:group name="MenuNodes">
    <xs:choice>
      <xs:element name="MenuItem" type="MenuItem" />
      <xs:element name="MenuSpacer" />
      <xs:element name="SubMenu" type="Menu" />
    </xs:choice>
  </xs:group>
  <!--
		A Menu Item that appears in a top-level menu or in a sub-menu
	-->
  <xs:complexType name="MenuItem">
    <xs:sequence>
      <xs:element name="Titles" minOccurs="1" maxOccurs="1" type="LocalizedTitles" />
    </xs:sequence>
    <xs:attribute name="Url" type="xs:string" use="optional" />
    <xs:attribute name="Icon" type="xs:string" use="optional" />
    <xs:attribute name="WinMode" type="xs:unsignedByte" use="optional" />
    <xs:attribute name="PassParams" type="CRM_Boolean" use="optional" />
    <xs:attribute name="WinParams" type="xs:string" use="optional" />
    <xs:attribute name="JavaScript" type="xs:string" use="optional" />
    <xs:attribute name="Client" type="xs:string" use="optional" />
    <xs:attribute name="AvailableOffline" type="xs:boolean" use="optional" />
    <xs:attribute name="AccessKey" type="CRM_AccessKey" use="optional" />
    <xs:attribute name="ValidForCreate" type="CRM_Boolean" use="optional" />
    <xs:attribute name="ValidForUpdate" type="CRM_Boolean" use="optional" />
  </xs:complexType>
  <!--
		A Tool Bar that contains buttons
	-->
  <xs:complexType name="ToolBar">
    <xs:sequence>
      <xs:choice maxOccurs="unbounded">
        <xs:element name="Button">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="Titles" minOccurs="0" maxOccurs="1" type="LocalizedTitles" />
              <xs:element name="ToolTips" minOccurs="0" maxOccurs="1" type="LocalizedToolTips" />
            </xs:sequence>
            <xs:attribute name="Icon" type="xs:string" use="optional" />
            <xs:attribute name="Url" type="xs:string" use="optional" />
            <xs:attribute name="JavaScript" type="xs:string" use="optional" />
            <xs:attribute name="PassParams" type="CRM_Boolean" use="optional" />
            <xs:attribute name="WinParams" type="xs:string" use="optional" />
            <xs:attribute name="WinMode" type="xs:unsignedByte" use="optional" />
            <xs:attribute name="Client" type="xs:string" use="optional" />
            <xs:attribute name="AvailableOffline" type="xs:boolean" use="optional" />
            <xs:attribute name="AccessKey" type="CRM_AccessKey" use="optional" />
            <xs:attribute name="ValidForCreate" type="CRM_Boolean" use="optional" />
            <xs:attribute name="ValidForUpdate" type="CRM_Boolean" use="optional" />
          </xs:complexType>
        </xs:element>
        <xs:element name="ToolBarSpacer" />
      </xs:choice>
    </xs:sequence>
    <xs:attribute name="ValidForCreate" type="CRM_Boolean" use="optional" />
    <xs:attribute name="ValidForUpdate" type="CRM_Boolean" use="optional" />
  </xs:complexType>
  <xs:complexType name="LocalizedTitles">
    <xs:sequence minOccurs="1" maxOccurs="unbounded">
      <xs:element name="Title" type="LocalizedLabel" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="LocalizedToolTips">
    <xs:sequence minOccurs="1" maxOccurs="unbounded">
      <xs:element name="ToolTip" type="LocalizedLabel" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="LocalizedLabel">
    <xs:attribute name="LCID" type="xs:integer" />
    <xs:attribute name="Text" type="xs:string" />
  </xs:complexType>
  <xs:complexType name="EntityNode">
    <xs:all>
      <xs:element name="MenuBar" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="CustomMenus" minOccurs="0" maxOccurs="1">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="Menu" minOccurs="0" maxOccurs="unbounded" type="Menu" />
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="ToolBar" minOccurs="0" maxOccurs="1" type="ToolBar" />
      <xs:element name="NavBar" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:sequence>
            <xs:element maxOccurs="unbounded" name="NavBarItem">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="Titles" minOccurs="1" maxOccurs="1" type="LocalizedTitles" />
                </xs:sequence>
                <xs:attribute name="Icon" type="xs:string" use="required" />
                <xs:attribute name="Url" type="xs:string" use="required" />
                <xs:attribute name="Id" type="xs:string" use="required" />
                <xs:attribute name="PassParams" type="CRM_Boolean" use="optional" />
                <xs:attribute name="Area" type="xs:string" use="optional" />
                <xs:attribute name="Client" type="xs:string" use="optional" />
                <xs:attribute name="AvailableOffline" type="xs:boolean" use="optional" />
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attribute name="ValidForCreate" type="CRM_Boolean" use="optional" />
          <xs:attribute name="ValidForUpdate" type="CRM_Boolean" use="optional" />
        </xs:complexType>
      </xs:element>
      <xs:element name="Grid" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="MenuBar">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="ActionsMenu" type="Menu" minOccurs="0" />
                  <xs:element name="Buttons" type="ToolBar" minOccurs="0" />
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:all>
    <xs:attribute name="name" type="xs:string" use="required" />
    <xs:attribute name="Client" type="CRM_Client" use="optional" />
    <xs:attribute name="AvailableOffline" type="xs:boolean" use="optional" />
  </xs:complexType>
  <xs:simpleType name="CRM_Client">
    <xs:restriction base="xs:string">
      <xs:pattern value="((None|Outlook|Web|All|OutlookWorkstationClient|OutlookLaptopClient),?)+" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="CRM_Boolean">
    <xs:restriction base="xs:unsignedByte">
      <xs:minInclusive value="0" />
      <xs:maxInclusive value="1" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="CRM_AccessKey">
    <xs:restriction base="xs:string">
      <xs:length value="1" />
    </xs:restriction>
  </xs:simpleType>
  <!--<xs:include schemaLocation="isv.config.xsd" /> END-->
  <!--<xs:include schemaLocation="../_root/SiteMapType.xsd" /> START-->
  <xs:simpleType name="LCIDType_SiteMap">
    <xs:restriction base="xs:decimal">
      <xs:fractionDigits value="0" fixed="true" />
      <xs:totalDigits value="4" />
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="TitlesType_SiteMap">
    <xs:sequence>
      <xs:element name="Title" minOccurs="1" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="LCID" type="LCIDType_SiteMap" use="required" />
          <xs:attribute name="Title" type="xs:string" use="required" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="DescriptionsType_SiteMap">
    <xs:sequence>
      <xs:element name="Description" minOccurs="1" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="LCID" type="LCIDType_SiteMap" use="required" />
          <xs:attribute name="Description" type="xs:string" use="required" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name ="SiteMapType">
    <xs:sequence>
      <xs:element name="Area" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="Titles" type="TitlesType_SiteMap" minOccurs="0" maxOccurs="1" />
            <xs:element name="Descriptions" type="DescriptionsType_SiteMap" minOccurs="0" maxOccurs="1" />
            <xs:element name="Group" minOccurs="0" maxOccurs="unbounded">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="Titles" type="TitlesType_SiteMap" minOccurs="0" maxOccurs="1" />
                  <xs:element name="Descriptions" type="DescriptionsType_SiteMap" minOccurs="0" maxOccurs="1" />
                  <xs:element name="SubArea" minOccurs="0" maxOccurs="unbounded">
                    <xs:complexType>
                      <xs:sequence>
                        <xs:element name="Titles" type="TitlesType_SiteMap" minOccurs="0" maxOccurs="1" />
                        <xs:element name="Descriptions" type="DescriptionsType_SiteMap" minOccurs="0" maxOccurs="1" />
                        <xs:element name="Privilege" minOccurs="0" maxOccurs="unbounded">
                          <xs:complexType>
                            <xs:attribute name="Entity" type="xs:string" />
                            <xs:attribute name="Privilege" type="CRM_PrivilegeId_SiteMap" />
                          </xs:complexType>
                        </xs:element>
                      </xs:sequence>
                      <xs:attribute name="Id" type="CRM_Identifier_SiteMap" use="required" />
                      <!--<xs:attribute name="Title" type="xs:string" />-->
                      <xs:attribute name="ResourceId" type="xs:string" />
                      <xs:attribute name="Icon" type="xs:string" />
                      <xs:attribute name="OutlookShortcutIcon" type="xs:string" />
                      <xs:attribute name="Url" type="xs:string" />
                      <xs:attribute name="PassParams" type="xs:boolean" use="optional" />
                      <xs:attribute name="Client" type="CRM_Client_SiteMap" />
                      <xs:attribute name="AvailableOffline" type="xs:boolean" />
                      <!--<xs:attribute name="License" type="CRM_License_SiteMap" />-->
                      <xs:attribute name="Entity" type="xs:string" />
                      <!--<xs:attribute name="Description" type="xs:string" />-->
                      <xs:attribute name="DescriptionResourceId" type="xs:string" />
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
                <xs:attribute name="Id" type="CRM_Identifier_SiteMap" use="required" />
                <!--<xs:attribute name="Title" type="xs:string" />-->
                <xs:attribute name="Icon" type="xs:string" />
                <xs:attribute name="Url" type="xs:string" />
                <xs:attribute name="ResourceId" type="xs:string" />
                <xs:attribute name="IsProfile" type="xs:boolean" />
                <!--<xs:attribute name="License" type="CRM_License_SiteMap" />-->
                <!--<xs:attribute name="Description" type="xs:string" />-->
                <xs:attribute name="DescriptionResourceId" type="xs:string" />
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attribute name="Id" type="CRM_Identifier_SiteMap" use="required" />
          <!--<xs:attribute name="Title" type="xs:string" />-->
          <xs:attribute name="ResourceId" type="xs:string" />
          <xs:attribute name="Icon" type="xs:string" />
          <xs:attribute name="Url" type="xs:string" />
          <xs:attribute name="ShowGroups" type="xs:boolean" />
          <!--<xs:attribute name="License" type="CRM_License_SiteMap" />-->
          <!--<xs:attribute name="Description" type="xs:string" />-->
          <xs:attribute name="DescriptionResourceId" type="xs:string" />
        </xs:complexType>
        <xs:unique name="GroupIdMustBeUnique">
          <xs:selector xpath="Group" />
          <xs:field xpath="@Id" />
        </xs:unique>
        <xs:unique name="SubAreaIdMustBeUnique">
          <xs:selector xpath="Group/SubArea" />
          <xs:field xpath="@Id" />
        </xs:unique>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="Url" type="xs:string" />
  </xs:complexType>
  <xs:simpleType name="CRM_Identifier_SiteMap">
    <xs:restriction base="xs:string">
      <xs:pattern value="[a-zA-Z0-9_]+" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="CRM_Client_SiteMap">
    <xs:restriction base="xs:string">
      <xs:pattern value="((Outlook|Web|All|OutlookWorkstationClient|OutlookLaptopClient),?)+" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="CRM_License_SiteMap">
    <xs:restriction base="xs:string" />
  </xs:simpleType>
  <xs:simpleType name="CRM_PrivilegeId_SiteMap">
    <xs:restriction base="xs:string">
      <xs:pattern value="((Read|Write|Append|AppendTo|Create|Delete|Share|Assign|All|AllowQuickCampaign),?)+" />
    </xs:restriction>
  </xs:simpleType>
  <!--<xs:include schemaLocation="../_root/SiteMapType.xsd" /> END-->
  <xs:simpleType name="ObjectTypeCodeType">
    <xs:restriction base="xs:positiveInteger"></xs:restriction>
  </xs:simpleType>
  <xs:complexType name="SerializedInteger">
    <xs:simpleContent>
      <xs:extension base="xs:nonNegativeInteger">
        <xs:attribute name="formattedvalue" type="xs:string" />
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
  <xs:simpleType name="TrueFalseType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="True" />
      <xs:enumeration value="False" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="TrueFalse01Type">
    <xs:restriction base="xs:string">
      <xs:enumeration value="0" />
      <xs:enumeration value="1" />
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="SerializedTrueFalse01Type">
    <xs:simpleContent>
      <xs:extension base="TrueFalse01Type">
        <xs:attribute name="name" type="xs:string" />
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
  <xs:simpleType name="GuidType">
    <xs:annotation>
      <xs:documentation xml:lang="en">
				The representation of a GUID, generally the id of an element.
			</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:pattern value="\{[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}\}" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="LengthPositiveInteger">
    <xs:restriction base="xs:positiveInteger" />
  </xs:simpleType>
  <xs:simpleType name="LengthMax">
    <xs:restriction base="xs:string">
      <xs:pattern value="max" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="LengthType">
    <xs:union memberTypes="LengthPositiveInteger LengthMax " />
  </xs:simpleType>
  <xs:simpleType name="CrmDataType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="virtual" />
      <xs:enumeration value="primarykey" />
      <xs:enumeration value="uniqueidentifier" />
      <xs:enumeration value="char" />
      <xs:enumeration value="nchar" />
      <xs:enumeration value="varchar" />
      <xs:enumeration value="nvarchar" />
      <xs:enumeration value="ntext" />
      <xs:enumeration value="text" />
      <xs:enumeration value="numeric" />
      <xs:enumeration value="int" />
      <xs:enumeration value="smallint" />
      <xs:enumeration value="tinyint" />
      <xs:enumeration value="bigint" />
      <xs:enumeration value="binary" />
      <xs:enumeration value="varbinary" />
      <xs:enumeration value="image" />
      <xs:enumeration value="float" />
      <xs:enumeration value="decimal" />
      <xs:enumeration value="real" />
      <xs:enumeration value="money" />
      <xs:enumeration value="smallmoney" />
      <xs:enumeration value="bit" />
      <xs:enumeration value="timezone" />
      <xs:enumeration value="datetime" />
      <xs:enumeration value="smalldatetime" />
      <xs:enumeration value="timestamp" />
      <xs:enumeration value="lookup" />
      <xs:enumeration value="picklist" />
      <xs:enumeration value="partylist" />
      <xs:enumeration value="customer" />
      <xs:enumeration value="owner" />
      <xs:enumeration value="state" />
      <xs:enumeration value="status" />
      <xs:enumeration value="sql_variant" />
      <xs:enumeration value="phoneticguide" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="CrmCascadeSecurityLinkType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="ActiveOnly" />
      <xs:enumeration value="Cascade" />
      <xs:enumeration value="NoCascade" />
      <xs:enumeration value="UserOwned" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="CrmCascadeDeleteLinkType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="Cascade" />
      <xs:enumeration value="RemoveLink" />
      <xs:enumeration value="Restrict" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="NavPaneDisplayOptionType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="UseCollectionName" />
      <xs:enumeration value="UseLabel" />
      <xs:enumeration value="DoNotDisplay" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="NavPaneAreaType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="Details" />
      <xs:enumeration value="Sales" />
      <xs:enumeration value="Service" />
      <xs:enumeration value="Marketing" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="CrmEntityIconType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="GridIcon" />
      <xs:enumeration value="NavigationIcon" />
      <xs:enumeration value="OutlookShortcutIcon" />
      <xs:enumeration value="WatermarkIcon" />
      <xs:enumeration value="LargeEntityIcon" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="EntityAttributeNameBaseType">
    <xs:restriction base="xs:string">
      <xs:minLength value="1" />
      <xs:maxLength value="50" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="EntityAttributeLocalizedNameBaseType">
    <xs:restriction base="xs:string">
      <xs:minLength value="1" />
      <xs:maxLength value="50" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="EntityAttributeOriginalNameBaseType">
    <xs:restriction base="xs:string">
      <xs:maxLength value="50" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="EntityRelationshipTypeType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="OneToMany" />
      <xs:enumeration value="ManyToMany" />
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="EntityRelationshipRolesType">
    <xs:sequence>
      <xs:element name="EntityRelationshipRole" minOccurs="1" maxOccurs="2">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="NavPaneDisplayOption" type="NavPaneDisplayOptionType" minOccurs="1" maxOccurs="1" />
            <xs:element name="NavPaneArea" type="NavPaneAreaType" minOccurs="1" maxOccurs="1" />
            <xs:element name="NavPaneOrder" type="xs:nonNegativeInteger" minOccurs="0" maxOccurs="1" />
            <xs:element name="CustomLabels" type="CustomLabelsType" minOccurs="0" maxOccurs="1" />
            <xs:element name="AssociationRoleOrdinal" type="xs:nonNegativeInteger" minOccurs="0" maxOccurs="1" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:element name="LocalizedName" type="EntityAttributeLocalizedNameBaseType" />
  <xs:element name="LocalizedCollectionName" type="EntityAttributeLocalizedNameBaseType" />
  <xs:complexType name="EntityNameType">
    <xs:simpleContent>
      <xs:extension base="EntityAttributeNameBaseType">
        <xs:attribute name="LocalizedName" type="EntityAttributeLocalizedNameBaseType" use="required" />
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
  <xs:complexType name="LocalizedNamesType">
    <xs:sequence>
      <xs:element name="LocalizedName" type="FieldXmlFieldUIType" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="LocalizedCollectionNamesType">
    <xs:sequence>
      <xs:element name="LocalizedCollectionName" type="FieldXmlFieldUIType" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="DescriptionsType">
    <xs:sequence>
      <xs:element name="Description" type="FieldXmlFieldUIType" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="CustomLabelsType">
    <xs:sequence>
      <xs:element name="CustomLabel" type="FieldXmlFieldUIType" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="LookupTypesType">
    <xs:sequence>
      <xs:element minOccurs="0" maxOccurs="unbounded" name="LookupType">
        <xs:complexType>
          <xs:simpleContent>
            <xs:extension base="xs:integer">
              <xs:attribute name="id" type="xs:string" use="required" />
            </xs:extension>
          </xs:simpleContent>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="displaynamestype">
    <xs:sequence>
      <xs:element name="displayname" type="FieldXmlFieldUIType" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="statestype">
    <xs:sequence>
      <xs:element name="state" minOccurs="1" maxOccurs="unbounded">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="labels" minOccurs="1" maxOccurs="1">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="label" type="FieldXmlFieldUIType" minOccurs="1" maxOccurs="unbounded" />
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attribute name="value" use="required" type="xs:integer" />
          <xs:attribute name="defaultstatus" use="required" type="xs:integer" />
          <xs:attribute name="invariantname" use="required" type="xs:string" />
          <xs:attribute name="addedby" type="xs:string"></xs:attribute>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="statusestype">
    <xs:sequence>
      <xs:element name="status" minOccurs="1" maxOccurs="unbounded">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="labels" minOccurs="1" maxOccurs="1">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="label" type="FieldXmlFieldUIType" minOccurs="1" maxOccurs="unbounded" />
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attribute name="value" use="required" type="xs:integer" />
          <xs:attribute name="state" type="xs:integer" />
          <xs:attribute name="defaultstatus" type="xs:integer" />
          <xs:attribute name="addedby" type="xs:string"></xs:attribute>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="optionstype">
    <xs:sequence>
      <xs:element name="option" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="labels" minOccurs="1" maxOccurs="1">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="label" type="FieldXmlFieldUIType" minOccurs="1" maxOccurs="unbounded" />
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attribute name="id" type="GuidType" />
          <xs:attribute name="value" use="required" type="xs:integer" />
          <xs:attribute name="addedby" type="xs:string" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:simpleType name="CrmIdentifier">
    <xs:restriction base="xs:string">
      <xs:pattern value="[a-zA-Z0-9_]+" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="CrmClient">
    <xs:restriction base="xs:string">
      <xs:pattern value="((Outlook|Web|All|OutlookWorkstationClient|OutlookLaptopClient),?)+" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="CrmLicense">
    <xs:restriction base="xs:string">
      <xs:pattern value="((SmallBusiness|Professional|All),?)+" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="CrmPrivilegeId">
    <xs:restriction base="xs:string">
      <xs:pattern value="((Read|Write|Append|AppendTo|Create|Delete|Share|Assign|All|AllowQuickCampaign),?)+" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="BehaviorInBulkEditForm">
    <xs:restriction base="xs:string">
      <xs:enumeration value="Disabled" />
      <xs:enumeration value="EnabledButNoRender" />
      <xs:enumeration value="Enabled" />
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="StateCodeType">
    <xs:simpleContent>
      <xs:extension base="xs:nonNegativeInteger">
        <xs:attribute name="name" type="xs:string" />
        <xs:attribute name="formattedvalue" type="xs:string" />
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
  <xs:complexType name="LookupType">
    <xs:simpleContent>
      <xs:extension base="GuidType">
        <xs:attribute name="name" type="xs:string" />
        <xs:attribute name="dsc" type="xs:nonNegativeInteger" />
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
  <xs:element name="ImportExportXml">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Entities" type="EntitiesType" minOccurs="0" maxOccurs="1" />
        <xs:element name="Roles" type="RolesType" minOccurs="0" maxOccurs="1" />
        <xs:element name="Workflows" type="WorkflowsType" minOccurs="0" maxOccurs="1" />
        <xs:element name="Templates" type="TemplatesType" minOccurs="0" maxOccurs="1" />
        <xs:element name="IsvConfig" minOccurs="0" maxOccurs="1">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="configuration" type="IsvConfigurationType" maxOccurs="1" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="RelationshipRoles" type="RelationshipRolesType" minOccurs="0" maxOccurs="1" />
        <xs:element name="SiteMap" minOccurs="0" maxOccurs="1">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="SiteMap" type="SiteMapType" maxOccurs="1">
                <xs:unique name="AreaIdMustBeUnique">
                  <xs:selector xpath="Area" />
                  <xs:field xpath="@Id" />
                </xs:unique>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="EntityMaps" type="EntityMapsType" minOccurs="0" maxOccurs="1" />
        <xs:element name="EntityRelationships" type="EntityRelationShipsType" minOccurs="0" maxOccurs="1" />
        <xs:element name="OrganizationSettings" type="OrganizationSettingsType" minOccurs="0" maxOccurs="1" />
        <xs:element name="Languages" type="LanguagesType" minOccurs="1" maxOccurs="1" />
      </xs:sequence>
      <xs:attribute name="version" type="xs:string" />
      <xs:attribute name="languagecode" type="xs:nonNegativeInteger" />
      <xs:attribute name="generatedBy" type="xs:string" />
    </xs:complexType>
  </xs:element>
  <xs:complexType name="LanguagesType">
    <xs:sequence>
      <xs:element name="Language" type="xs:nonNegativeInteger" minOccurs="1" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="EntitiesType">
    <xs:sequence>
      <xs:element name="Entity" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="Name" minOccurs="1" maxOccurs="1">
              <xs:complexType>
                <xs:simpleContent>
                  <xs:extension base="EntityNameType">
                    <xs:attribute name="OriginalName" type="EntityAttributeOriginalNameBaseType" use="required" />
                  </xs:extension>
                </xs:simpleContent>
              </xs:complexType>
            </xs:element>
            <xs:element name="ObjectTypeCode" type="ObjectTypeCodeType" minOccurs="1" maxOccurs="1" />
            <xs:element name="EntityInfo" type="EntityInfoType" minOccurs="0" maxOccurs="1" />
            <xs:element name="FormXml" type="FormXmlType" minOccurs="0" maxOccurs="1" />
            <xs:element name="SavedQueries" type="SavedQueriesType" minOccurs="0" maxOccurs="1" />
            <xs:element name="Icons" type="IconsType" minOccurs="0" maxOccurs="1" />
            <xs:element name="Strings" type="StringsType" minOccurs="0" maxOccurs="1" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="EntityInfoType">
    <xs:choice minOccurs="1" maxOccurs="1">
      <xs:element name="entity">
        <xs:complexType>
          <xs:all>
            <xs:element name="HasRelatedNotes" type="TrueFalseType" minOccurs="0" maxOccurs="1" />
            <xs:element name="HasRelatedActivities" type="TrueFalseType" minOccurs="0" maxOccurs="1" />
            <xs:element name="ObjectTypeCode" type="ObjectTypeCodeType" minOccurs="0" maxOccurs="1" />
            <xs:element name="BaseTableName" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="WorkflowEventMask" type="xs:integer" minOccurs="0" maxOccurs="1" />
            <xs:element name="EventMask" type="xs:nonNegativeInteger" minOccurs="0" maxOccurs="1" />
            <xs:element name="IsCustomizable" type="TrueFalse01Type" minOccurs="0" maxOccurs="1" />
            <xs:element name="IsCustomEntity" type="TrueFalse01Type" minOccurs="0" maxOccurs="1" />
            <xs:element name="IsChildEntity" type="TrueFalse01Type" minOccurs="0" maxOccurs="1" />
            <xs:element name="IsParented" type="TrueFalse01Type" minOccurs="0" maxOccurs="1" />
            <xs:element name="IsCollaboration" type="TrueFalse01Type" minOccurs="0" maxOccurs="1" />
            <xs:element name="IsActivity" type="TrueFalse01Type" minOccurs="0" maxOccurs="1" />
            <xs:element name="IsActivityParty" type="TrueFalse01Type" minOccurs="0" maxOccurs="1" />
            <xs:element name="OwnershipTypeMask" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="IsMappable" type="TrueFalse01Type" minOccurs="0" maxOccurs="1" />
            <xs:element name="IsAudited" type="TrueFalse01Type" minOccurs="0" maxOccurs="1" />
            <xs:element name="IsReplicated" type="TrueFalse01Type" minOccurs="0" maxOccurs="1" />
            <xs:element name="IsReplicationUserFiltered" type="TrueFalse01Type" minOccurs="0" maxOccurs="1" />
            <xs:element name="IsRequiredOffline" type="TrueFalse01Type" minOccurs="0" maxOccurs="1" />
            <xs:element name="IsRenameable" type="TrueFalse01Type" minOccurs="0" maxOccurs="1" />
            <xs:element name="IsDuplicateCheckSupported" type="TrueFalse01Type" minOccurs="0" maxOccurs="1" />
            <xs:element name="OriginalLocalizedName" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="OriginalLocalizedCollectionName" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="LocalizedNames" type="LocalizedNamesType" minOccurs="1" maxOccurs="1" />
            <xs:element name="LocalizedCollectionNames" type="LocalizedCollectionNamesType" minOccurs="1" maxOccurs="1" />
            <xs:element name="Descriptions" type="DescriptionsType" minOccurs="0" maxOccurs="1" />
            <xs:element name="IsValidForAdvancedFind" type="TrueFalse01Type" minOccurs="0" maxOccurs="1" />
            <xs:element name="ExtensionTableName" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="ReportViewName" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="AddressTableName" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="UsesFullNameConventionRules" type="TrueFalse01Type" minOccurs="0" maxOccurs="1" />
            <xs:element name="EntityMask" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="DbCascadeMask" type="xs:nonNegativeInteger" minOccurs="0" maxOccurs="1" />
            <xs:element name="EntityID" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="EntityClassName" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="ServiceClassName" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="EntityAssembly" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="ServiceAssembly" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="CollectionName" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="LogicalCollectionName" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="CanTriggerWorkflow" type="TrueFalse01Type" minOccurs="0" maxOccurs="1" />
            <xs:element name="WorkflowSupport" type="xs:integer" minOccurs="0" maxOccurs="1" />
            <xs:element name="HasDeletionStateCode" type="xs:integer" minOccurs="0" maxOccurs="1" />
            <xs:element name="IsImportable" type="TrueFalse01Type" minOccurs="0" maxOccurs="1" />
            <xs:element name="CanBeChildInCustomRelationship" type="TrueFalse01Type" minOccurs="0" maxOccurs="1" />
            <xs:element name="CanBeInCustomEntityAssociation" type="TrueFalse01Type" minOccurs="0" maxOccurs="1" />
            <xs:element name="CanBeInCustomReflexiveRelationship" type="TrueFalse01Type" minOccurs="0" maxOccurs="1" />
            <xs:element name="IsMailMergeEnabled" type="TrueFalse01Type" minOccurs="0" maxOccurs="1" />
            <xs:element name="attributes" minOccurs="1" maxOccurs="1">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="attribute" minOccurs="0" maxOccurs="unbounded">
                    <xs:complexType>
                      <xs:all>
                        <xs:element name="Name" type="EntityAttributeNameBaseType" minOccurs="0" maxOccurs="1" />
                        <xs:element name="LogicalName" type="EntityAttributeNameBaseType" minOccurs="0" maxOccurs="1" />
                        <xs:element name="Type" type="CrmDataType" minOccurs="1" maxOccurs="1" />
                        <xs:element name="IsNullable" type="TrueFalse01Type" minOccurs="0" maxOccurs="1" />
                        <xs:element name="IsCustomField" type="TrueFalse01Type" minOccurs="0" maxOccurs="1" />
                        <xs:element name="ValidForCreateApi" type="TrueFalse01Type" minOccurs="0" maxOccurs="1" />
                        <xs:element name="ValidForReadApi" type="TrueFalse01Type" minOccurs="0" maxOccurs="1" />
												<xs:element name="LookupBrowse" type="TrueFalse01Type" minOccurs="0" maxOccurs="1" />
												<xs:element name="ValidForUpdateApi" type="TrueFalse01Type" minOccurs="0" maxOccurs="1" />
                        <xs:element name="IsPKAttribute" type="TrueFalse01Type" minOccurs="0" maxOccurs="1" />
                        <xs:element name="ColumnNumber" type="xs:positiveInteger" minOccurs="0" maxOccurs="1" />
                        <xs:element name="DisplayMask" type="xs:string" minOccurs="0" maxOccurs="1" />
                        <xs:element name="VisibleToPlatform" type="xs:string" minOccurs="0" maxOccurs="1" />
                        <xs:element name="Length" type="LengthType" minOccurs="0" maxOccurs="1" />
                        <xs:element name="RequiresPlatformAuthorization" type="TrueFalse01Type" minOccurs="0" maxOccurs="1" />
                        <xs:element name="ReferencedEntityObjectTypeCode" type="ObjectTypeCodeType" minOccurs="0" maxOccurs="1" />
                        <xs:element name="IsLogical" type="TrueFalse01Type" minOccurs="0" maxOccurs="1" />
                        <xs:element name="RelationshipName" type="xs:string" minOccurs="0" maxOccurs="1" />
                        <xs:element name="RemoteAttributeName" type="EntityAttributeNameBaseType" minOccurs="0" maxOccurs="1" />
                        <xs:element name="Description" type="xs:string" minOccurs="0" maxOccurs="1" />
                        <xs:element name="DefaultValue" type="xs:string" minOccurs="0" maxOccurs="1" />
                        <xs:element name="AttributeOf" type="EntityAttributeNameBaseType" minOccurs="0" maxOccurs="1" />
                        <xs:element name="YomiOf" type="EntityAttributeNameBaseType" minOccurs="0" maxOccurs="1" />
                        <xs:element name="CalculationOf" type="EntityAttributeNameBaseType" minOccurs="0" maxOccurs="1" />
                        <xs:element name="AggregateOf" type="EntityAttributeNameBaseType" minOccurs="0" maxOccurs="1" />
                        <xs:element name="XmlAbbreviation" type="xs:string" minOccurs="0" maxOccurs="1" />
                        <xs:element name="IsSortAttribute" type="TrueFalse01Type" minOccurs="0" maxOccurs="1" />
                        <xs:element name="EntityID" type="xs:string" minOccurs="0" maxOccurs="1" />
                        <xs:element name="AttributeId" type="xs:string" minOccurs="0" maxOccurs="1" />
                        <xs:element name="AttributeTypeId" type="xs:string" minOccurs="0" maxOccurs="1" />
                        <xs:element name="AttributeOfId" type="xs:string" minOccurs="0" maxOccurs="1" />
                        <xs:element name="ImeMode" type="xs:string" minOccurs="0" maxOccurs="1" />
                        <xs:element name="RequiredLevel" type="xs:string" minOccurs="0" maxOccurs="1" />
                        <xs:element name="Format" type="xs:string" minOccurs="0" maxOccurs="1" />
                        <xs:element name="MaxLength" type="xs:integer" minOccurs="0" maxOccurs="1" />
                        <xs:element name="MinValue" type="xs:double" minOccurs="0" maxOccurs="1" />
                        <xs:element name="MaxValue" type="xs:double" minOccurs="0" maxOccurs="1" />
                        <xs:element name="Accuracy" type="xs:integer" minOccurs="0" maxOccurs="1" />
                        <xs:element name="LookupClass" type="xs:string" minOccurs="0" maxOccurs="1" />
                        <xs:element name="LookupStyle" type="xs:string" minOccurs="0" maxOccurs="1" />
                        <xs:element name="LookupTypes" type="LookupTypesType" minOccurs="0" maxOccurs="1" />
                        <xs:element name="Descriptions" type="DescriptionsType" minOccurs="0" maxOccurs="1" />
                        <xs:element name="displaynames" type="displaynamestype" minOccurs="0" maxOccurs="1" />
                        <xs:element name="states" type="statestype" minOccurs="0" maxOccurs="1" />
                        <xs:element name="statuses" type="statusestype" minOccurs="0" maxOccurs="1" />
                        <xs:element name="options" type="optionstype" minOccurs="0" maxOccurs="1" />
                        <xs:element name="AppDefaultValue" type="xs:integer" minOccurs="0" maxOccurs="1" />
                        <xs:element name="Locked" type="xs:integer" minOccurs="0" maxOccurs="1" />
                        <xs:element name="AccuracySource" type="xs:integer" minOccurs="0" maxOccurs="1" />
                      </xs:all>
                      <xs:attribute name="PhysicalName" use="required" type="EntityAttributeNameBaseType" />
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:all>
          <xs:attribute name="Name" use="required" type="EntityAttributeNameBaseType" />
        </xs:complexType>
      </xs:element>
    </xs:choice>
  </xs:complexType>
  <xs:complexType name="EntityMapsType">
    <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:element name="EntityMap">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="EntitySource" type="xs:string" minOccurs="1" maxOccurs="1" />
            <xs:element name="EntityTarget" type="xs:string" minOccurs="1" maxOccurs="1" />
            <xs:element name="AttributeMaps" minOccurs="0" maxOccurs="1">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="AttributeMap" minOccurs="0" maxOccurs="unbounded">
                    <xs:complexType>
                      <xs:sequence>
                        <xs:element name="AttributeSource" type="EntityAttributeNameBaseType" minOccurs="1" maxOccurs="1" />
                        <xs:element name="AttributeTarget" type="EntityAttributeNameBaseType" minOccurs="1" maxOccurs="1" />
                      </xs:sequence>
                      <xs:attribute name="addedby" type="xs:string" />
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attribute name="addedby" type="xs:string" />
        </xs:complexType>
      </xs:element>
    </xs:choice>
  </xs:complexType>
  <xs:complexType name="RolesType">
    <xs:sequence>
      <xs:element name="Role" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="RolePrivilege" type="RolePrivilegeType" minOccurs="0" maxOccurs="unbounded" />
          </xs:sequence>
          <xs:attribute name="name" use="required" type="xs:string" />
          <xs:attribute name="id" use="required" type="GuidType" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="RolePrivilegeType">
    <xs:attribute name="name" use="required" type="xs:string" />
    <xs:attribute name="level" use="required" type="PrivilegeLevelType" />
  </xs:complexType>
  <xs:simpleType name="PrivilegeLevelType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="Basic" />
      <xs:enumeration value="Local" />
      <xs:enumeration value="Deep" />
      <xs:enumeration value="Global" />
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="WorkflowsType">
    <xs:sequence>
      <xs:element name="Workflow" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="EntityXml" type="EntityXmlType" minOccurs="1" maxOccurs="1" />
            <xs:element name="EntityDependency" type="EntityDependencyType" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="WorkflowDependency" type="WorkflowDependencyType" minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="AttributeDependency" type="AttributeDependencyType" minOccurs="0" maxOccurs="unbounded" />
          </xs:sequence>
          <xs:attribute name="name" use="required" type="xs:string" />
          <xs:attribute name="description" use="required" type="xs:string" />
          <xs:attribute name="workflowid" use="required" type="GuidType" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="WorkflowDependencyType">
    <xs:attribute name="workflowdependencyid" use="required" type="GuidType" />
    <xs:attribute name="entityxml" use="required" type="xs:string" />
  </xs:complexType>
  <xs:complexType name="EntityDependencyType">
    <xs:attribute name="name" use="required" type="EntityAttributeNameBaseType" />
    <xs:attribute name="isorgowned" use="required" type="TrueFalseType" />
    <xs:attribute name="isuserowned" use="required" type="TrueFalseType" />
    <xs:attribute name="isunowned" use="required" type="TrueFalseType" />
  </xs:complexType>
  <xs:complexType name="AttributeDependencyType">
    <xs:attribute name="name" use="required" type="EntityAttributeNameBaseType" />
    <xs:attribute name="entityname" use="required" type="EntityAttributeNameBaseType" />
    <xs:attribute name="type" use="required" type="xs:positiveInteger" />
  </xs:complexType>
  <xs:complexType name="FieldXmlFieldUIType">
    <xs:attribute name="id" type="GuidType" />
    <xs:attribute name="description" use="required" type="xs:string" />
    <xs:attribute name="languagecode" use="required" type="xs:positiveInteger" />
  </xs:complexType>
  <xs:complexType name="EntityXmlType">
    <xs:sequence>
      <xs:element name="workflow" type="WorkflowRootType" minOccurs="1" maxOccurs="1" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="WorkflowRootType">
    <xs:all>
      <xs:element name="statecode" type="StateCodeType" minOccurs="0" maxOccurs="1" />
      <xs:element name="type" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:simpleContent>
            <xs:extension base="xs:nonNegativeInteger">
              <xs:attribute name="name" type="xs:string" />
            </xs:extension>
          </xs:simpleContent>
        </xs:complexType>
      </xs:element>
      <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1" />
      <xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1"/>
      <xs:element name="activeworkflowid" type="LookupType" minOccurs="0" maxOccurs="1" />
      <xs:element name="parentworkflowid" type="LookupType" minOccurs="0" maxOccurs="1" />
      <xs:element name="iscrmuiworkflow" type="TrueFalse01Type" minOccurs="0" maxOccurs="1" />
      <xs:element name="workflowid" type="GuidType" minOccurs="0" maxOccurs="1" />
      <xs:element name="activities" type="xs:string" minOccurs="0" maxOccurs="1" />
      <xs:element name="rules" type="xs:string" minOccurs="0" maxOccurs="1" />
      <xs:element name="plugintypeid" type="LookupType" minOccurs="0" maxOccurs="1" />
      <xs:element name="statuscode" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:simpleContent>
            <xs:extension base="xs:nonNegativeInteger">
              <xs:attribute name="name" type="xs:string" />
            </xs:extension>
          </xs:simpleContent>
        </xs:complexType>
      </xs:element>
      <xs:element name="subprocess" type="TrueFalse01Type" minOccurs="0" maxOccurs="1" />
      <xs:element name="scope" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:simpleContent>
            <xs:extension base="xs:nonNegativeInteger">
              <xs:attribute name="name" type="xs:string" />
            </xs:extension>
          </xs:simpleContent>
        </xs:complexType>
      </xs:element>
      <xs:element name="ondemand" type="TrueFalse01Type" minOccurs="0" maxOccurs="1" />
      <xs:element name="primaryentity" type="xs:nonNegativeInteger" minOccurs="0" maxOccurs="1" />
      <xs:element name="uidata" type="xs:string" minOccurs="0" maxOccurs="1" />
    </xs:all>
    <xs:attribute name="version" type="xs:string" use="optional"/>
  </xs:complexType>
  
  <xs:complexType name="OrganizationSettingsType">
    <xs:sequence>
      <xs:element name="general" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="fullnameconventioncode" type="xs:integer" minOccurs="0" maxOccurs="1" />
            <xs:element name="numberformat" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="negativeformatcode" type="xs:integer" minOccurs="0" maxOccurs="1" />
            <xs:element name="currencysymbol" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="currencyformatcode" type="xs:integer" minOccurs="0" maxOccurs="1" />
            <xs:element name="pricingdecimalprecision" type="xs:integer" minOccurs="0" maxOccurs="1" />
            <xs:element name="sharetopreviousowneronassign" type="TrueFalseType" minOccurs="0" maxOccurs="1" />
            <xs:element name="blockedattachments" type="xs:string" minOccurs="0" maxOccurs="1" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="calendar" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="weekstartdaycode" type="xs:integer" minOccurs="0" maxOccurs="1" />
            <xs:element name="calendartype" type="xs:integer" minOccurs="0" maxOccurs="1" />
            <xs:element name="dateformatcode" type="xs:integer" minOccurs="0" maxOccurs="1" />
            <xs:element name="dateseparator" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="timeformatcode" type="xs:integer" minOccurs="0" maxOccurs="1" />
            <xs:element name="showweeknumber" type="TrueFalseType" minOccurs="0" maxOccurs="1" />
            <xs:element name="maxappointmentdurationdays" type="xs:integer" minOccurs="0" maxOccurs="1" />
            <xs:element name="dateformatstring" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="timeformatstring" type="xs:string" minOccurs="0" maxOccurs="1" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="email" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="trackingprefix" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="trackingtokenidbase" type="xs:integer" minOccurs="0" maxOccurs="1" />
            <xs:element name="trackingtokeniddigits" type="xs:byte" minOccurs="0" maxOccurs="1" />
            <xs:element name="maximumtrackingnumber" type="xs:integer" minOccurs="0" maxOccurs="1" />
            <xs:element name="ignoreinternalemail" type="TrueFalseType" minOccurs="0" maxOccurs="1" />
            <xs:element name="rendersecureiframeforemail" type="TrueFalseType" minOccurs="0" maxOccurs="1" />
            <xs:element name="allowunresolvedpartiesonemailsend" type="TrueFalseType" minOccurs="0" maxOccurs="1" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="marketing" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="allowmarketingemailexecution" type="TrueFalseType" minOccurs="0" maxOccurs="1" />
            <xs:element name="allowautoresponsecreation" type="TrueFalseType" minOccurs="0" maxOccurs="1" />
            <xs:element name="allowautounsubscribe" type="TrueFalseType" minOccurs="0" maxOccurs="1" />
            <xs:element name="allowautounsubscribeacknowledgement" type="TrueFalseType" minOccurs="0" maxOccurs="1" />
            <xs:element name="acknowledgementtemplateid" type="GuidType" minOccurs="0" maxOccurs="1" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="customization" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="schemanameprefix" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="isvintegrationcode" type="xs:integer" minOccurs="0" maxOccurs="1" />
            <xs:element name="isappmode" type="TrueFalseType" minOccurs="0" maxOccurs="1" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="outlookSynchronization" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="tagpollingperiod" type="xs:integer" minOccurs="0" maxOccurs="1" />
            <xs:element name="tagmaxaggressivecycles" type="xs:byte" minOccurs="0" maxOccurs="1" />
            <xs:element name="allowoutlookscheduledsyncs" type="TrueFalseType" minOccurs="0" maxOccurs="1" />
            <xs:element name="minoutlooksyncinterval" type="xs:integer" minOccurs="0" maxOccurs="1" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="autoNumbering" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="campaignprefix" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="contractprefix" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="caseprefix" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="kbprefix" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="orderprefix" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="invoiceprefix" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="uniquespecifierlength" type="xs:integer" minOccurs="0" maxOccurs="1" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="EntityRelationShipsType">
    <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:element name="EntityRelationship">
        <xs:complexType>
          <xs:all>
            <xs:element name="EntityRelationshipType" type="EntityRelationshipTypeType" minOccurs="1" 
                        maxOccurs="1" />
            <xs:element name="ReferencingAttributeName" type="EntityAttributeNameBaseType" minOccurs="0" 
                        maxOccurs="1" />
            <xs:element name="ReferencingAttributeRequiredLevel" type="xs:nonNegativeInteger" minOccurs="0" 
                        maxOccurs="1" />
            <xs:element name="RelationshipDescription" minOccurs="0" maxOccurs="1">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="Descriptions" type="DescriptionsType" minOccurs="0" maxOccurs="1" />
                </xs:sequence>
              </xs:complexType>
            </xs:element>
            <xs:element name="ReferencingEntityName" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="ReferencedEntityName" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="FirstEntityName" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="SecondEntityName" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="IntersectEntityName" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="CascadeAssign" type="CrmCascadeSecurityLinkType" minOccurs="0" maxOccurs="1" />
            <xs:element name="CascadeDelete" type="CrmCascadeDeleteLinkType" minOccurs="0" maxOccurs="1" />
            <xs:element name="CascadeReparent" type="CrmCascadeSecurityLinkType" minOccurs="0" maxOccurs="1" />
            <xs:element name="CascadeShare" type="CrmCascadeSecurityLinkType" minOccurs="0" maxOccurs="1" />
            <xs:element name="CascadeUnshare" type="CrmCascadeSecurityLinkType" minOccurs="0" maxOccurs="1" />
            <xs:element name="field" minOccurs="0" maxOccurs="1">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="displaynames" type="displaynamestype" minOccurs="1" maxOccurs="unbounded" />
                </xs:sequence>
                <xs:attribute name="name" type="xs:string" use="required" />
                <xs:attribute name="requiredlevel" type="xs:string" use="required" />
                <xs:attribute name="imemode" type="xs:string" use="required" />
                <xs:attribute name="lookupstyle" type="xs:string" use="optional" />
                <xs:attribute name="lookupbrowse" type="TrueFalse01Type" use="optional" />
                <xs:attribute name="lookuptypes" type="xs:string" use="optional" />
                <xs:attribute name="lookupclass" type="xs:string" use="optional" />
                <xs:attribute name="format" type="xs:string" use="optional" />
              </xs:complexType>
            </xs:element>
            <xs:element name="EntityRelationshipRoles" type="EntityRelationshipRolesType" minOccurs="0" maxOccurs="1" />
          </xs:all>
          <xs:attribute name="Name" use="required" type="xs:string" />
        </xs:complexType>
      </xs:element>
    </xs:choice>
  </xs:complexType>
  <xs:complexType name="IconsType">
    <xs:sequence>
      <xs:element name="Icon" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:simpleContent>
            <xs:extension base="xs:base64Binary">
              <xs:attribute name="type" use="required" type="CrmEntityIconType" />
            </xs:extension>
          </xs:simpleContent>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="StringsType">
    <xs:choice maxOccurs="unbounded">
      <xs:element name="Strings" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="String" minOccurs="0" maxOccurs="unbounded">
              <xs:complexType>
                <xs:simpleContent>
                  <xs:extension base="xs:string">
                    <xs:attribute name="languagecode" use="required" type="xs:string" />
                    <xs:attribute name="Comment" use="required" type="xs:string" />
                  </xs:extension>
                </xs:simpleContent>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attribute name="ResourceKey" use="required" type="xs:string" />
        </xs:complexType>
      </xs:element>
    </xs:choice>
  </xs:complexType>
  <xs:complexType name="FormXmlType">
    <xs:sequence>
      <xs:element name="forms" minOccurs="1" maxOccurs="1">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="entity" minOccurs="1" maxOccurs="unbounded">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="form" minOccurs="1" maxOccurs="unbounded">
                    <xs:complexType>
                      <xs:sequence>
                        <xs:element name="data" minOccurs="0" maxOccurs="unbounded">
                          <xs:complexType>
                            <xs:attribute name="id" type="xs:string" />
                            <xs:attribute name="datafieldname" type="xs:string" />
                            <xs:attribute name="classid" type="GuidType" />
                          </xs:complexType>
                        </xs:element>
                        <xs:element name="tabs" minOccurs="1" maxOccurs="1">
                          <xs:complexType>
                            <xs:sequence>
                              <xs:element name="tab" minOccurs="1" maxOccurs="unbounded">
                                <xs:complexType>
                                  <xs:sequence>
                                    <xs:element name="labels" type="FormXmlLabelsType" minOccurs="0" maxOccurs="1" />
                                    <xs:element name="sections" minOccurs="0" maxOccurs="1">
                                      <xs:complexType>
                                        <xs:sequence>
                                          <xs:element name="section" minOccurs="0" maxOccurs="unbounded">
                                            <xs:complexType>
                                              <xs:sequence>
                                                <xs:element name="labels" type="FormXmlLabelsType" minOccurs="0" maxOccurs="1" />
                                                <xs:element name="rows" minOccurs="0" maxOccurs="unbounded">
                                                  <xs:complexType>
                                                    <xs:sequence>
                                                      <xs:element name="row" minOccurs="0" maxOccurs="unbounded">
                                                        <xs:complexType>
                                                          <xs:sequence>
                                                            <xs:element name="cell" minOccurs="0" maxOccurs="unbounded">
                                                              <xs:complexType>
                                                                <xs:all>
                                                                  <xs:element name="labels" type="FormXmlLabelsType" minOccurs="1" maxOccurs="1" />
                                                                  <xs:element name="control" minOccurs="0" maxOccurs="1">
                                                                    <xs:complexType>
                                                                      <xs:sequence>
                                                                        <xs:element name="parameters" minOccurs="0" maxOccurs="1">
                                                                          <xs:complexType>
                                                                            <xs:all>
                                                                              <xs:element name="ViewId" type="GuidType" minOccurs="0" maxOccurs="1" />
                                                                              <xs:element name="Url" type="xs:string" minOccurs="0" maxOccurs="1" />
                                                                              <xs:element name="PassParameters" type="xs:boolean" minOccurs="0" maxOccurs="1" />
                                                                              <xs:element name="Security" type="xs:boolean" minOccurs="0" maxOccurs="1" />
                                                                              <xs:element name="Scrolling" type="xs:string" minOccurs="0" maxOccurs="1" />
                                                                              <xs:element name="Border" type="xs:string" minOccurs="0" maxOccurs="1" />
                                                                              <xs:element name="Preload" type="xs:string" minOccurs="0" maxOccurs="1" />
                                                                              <xs:element name="AutoResolve" type="xs:boolean" minOccurs="0" maxOccurs="1" />
                                                                              <xs:element name="ResolveEmailAddress" type="xs:boolean" minOccurs="0" maxOccurs="1" />
                                                                            </xs:all>
                                                                          </xs:complexType>
                                                                        </xs:element>
                                                                      </xs:sequence>
                                                                      <xs:attribute name="id" type="xs:string" />
                                                                      <xs:attribute name="classid" type="GuidType" />
                                                                      <xs:attribute name="datafieldname" type="xs:string" />
                                                                      <xs:attribute name="disabled" type="xs:boolean" />
                                                                      <xs:attribute name="addedby" type="xs:string" />
                                                                    </xs:complexType>
                                                                  </xs:element>
                                                                  <xs:element name="events" type="FormXmlEventsType" minOccurs="0" maxOccurs="1" />
                                                                </xs:all>
                                                                <xs:attribute name="id" type="GuidType" />
                                                                <xs:attribute name="auto" type="xs:boolean" />
                                                                <xs:attribute name="showlabel" type="xs:boolean" />
                                                                <xs:attribute name="locklevel" type="xs:nonNegativeInteger" />
                                                                <xs:attribute name="rowspan" type="xs:nonNegativeInteger" />
                                                                <xs:attribute name="colspan" type="xs:nonNegativeInteger" />
                                                                <xs:attribute name="addedby" type="xs:string" />
                                                              </xs:complexType>
                                                            </xs:element>
                                                          </xs:sequence>
                                                          <xs:attribute name="addedby" type="xs:string" />
                                                          <xs:attribute name="height" type="xs:string" />
                                                        </xs:complexType>
                                                      </xs:element>
                                                    </xs:sequence>
                                                    <xs:attribute name="addedby" type="xs:string" />
                                                  </xs:complexType>
                                                </xs:element>
                                              </xs:sequence>
                                              <xs:attribute name="name" type="xs:string" />
                                              <xs:attribute name="showlabel" type="xs:boolean" />
                                              <xs:attribute name="showbar" type="xs:boolean" />
                                              <xs:attribute name="id" type="GuidType" />
                                              <xs:attribute name="IsUserDefined" type="xs:string" />
                                              <xs:attribute name="height" type="xs:string" />
                                              <xs:attribute name="locklevel" type="xs:nonNegativeInteger" />
                                              <xs:attribute name="labelwidth" type="xs:nonNegativeInteger" />
                                              <xs:attribute name="layout" type="xs:string" />
                                              <xs:attribute name="columns" type="xs:nonNegativeInteger" />
                                              <xs:attribute name="addedby" type="xs:string" />
                                            </xs:complexType>
                                          </xs:element>
                                        </xs:sequence>
                                        <xs:attribute name="addedby" type="xs:string" />
                                      </xs:complexType>
                                    </xs:element>
                                  </xs:sequence>
                                  <xs:attribute name="group" type="xs:string" />
                                  <xs:attribute name="name" type="xs:string" />
                                  <xs:attribute name="verticallayout" type="xs:boolean" />
                                  <xs:attribute name="showlabel" type="xs:boolean" />
                                  <xs:attribute name="id" type="GuidType" />
                                  <xs:attribute name="IsUserDefined" type="xs:string" />
                                  <xs:attribute name="locklevel" type="xs:nonNegativeInteger" />
                                  <xs:attribute name="addedby" type="xs:string" />
                                </xs:complexType>
                              </xs:element>
                            </xs:sequence>
                            <xs:attribute name="showlabels" type="xs:boolean" />
                            <xs:attribute name="addedby" type="xs:string" />
                          </xs:complexType>
                        </xs:element>
                        <xs:element name="events" type="FormXmlEventsType" minOccurs="0" maxOccurs="1" />
                        <xs:element name="externaldependencies" type="FormXmlExternalDependenciesType" minOccurs="0" maxOccurs="1" />
                      </xs:sequence>
                      <xs:attribute name="type" type="NonEmptyStringType" />
                      <xs:attribute name="id" type="GuidType" />
                      <xs:attribute name="enablerelatedinformation" type="xs:boolean" />
                      <xs:attribute name="relatedInformationCollapsed" type="xs:boolean" />
                      <xs:attribute name="hasmargin" type="xs:boolean" />
                      <xs:attribute name="addedby" type="xs:string" />
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
                <xs:attribute name="name" type="EntityAttributeNameBaseType" />
                <xs:attribute name="objecttypecode" type="xs:nonNegativeInteger" />
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="addedby" type="xs:string" />
    <xs:attribute name="id" type="GuidType" />
  </xs:complexType>
  <xs:simpleType name="NonEmptyStringType">
    <xs:restriction base="xs:string">
      <xs:minLength value="1" />
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="FormXmlLabelsType">
    <xs:sequence>
      <xs:element name="label" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="description" use="required" type="xs:string" />
          <xs:attribute name="languagecode" use="required" type="xs:positiveInteger" />
          <xs:attribute name="addedby" type="xs:string" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="FormXmlEventsType">
    <xs:sequence>
      <xs:element name="event" minOccurs="1" maxOccurs="unbounded">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="script" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="dependencies" minOccurs="0" maxOccurs="1">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="dependency" minOccurs="0" maxOccurs="unbounded">
                    <xs:complexType>
                      <xs:attribute name="id" type="xs:string" />
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attribute name="name" type="xs:string" />
          <xs:attribute name="BehaviorInBulkEditForm" type="BehaviorInBulkEditForm" />
          <xs:attribute name="application" type="xs:boolean" />
          <xs:attribute name="active" type="xs:boolean" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="FormXmlExternalDependenciesType">
    <xs:sequence>
      <xs:element name="dependency" minOccurs="1" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="id" type="xs:string" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="RelationshipRolesType">
    <xs:sequence>
      <xs:element name="RelationshipRole" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="relationshiproleid" type="GuidType" minOccurs="1" maxOccurs="1" />
            <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1" />
            <xs:element name="statecode" type="xs:nonNegativeInteger" minOccurs="1" maxOccurs="1" />
            <xs:element name="RelationshipRoleMap" minOccurs="0" maxOccurs="unbounded">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="relationshiprolemapid" type="GuidType" minOccurs="1" maxOccurs="1" />
                  <xs:element name="associateobjecttypecode" type="ObjectTypeCodeType" minOccurs="1" maxOccurs="1" />
                  <xs:element name="primaryobjecttypecode" type="ObjectTypeCodeType" minOccurs="1" maxOccurs="1" />
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="TemplatesType">
    <xs:sequence>
      <xs:element name="KBArticleTemplates" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="kbarticletemplate" minOccurs="0" maxOccurs="unbounded">
              <xs:complexType>
                <xs:all>
                  <xs:element name="kbarticletemplateid" type="GuidType" minOccurs="1" maxOccurs="1" />
                  <xs:element name="structurexml" type="xs:string" minOccurs="0" maxOccurs="1" />
                  <xs:element name="formatxml" type="xs:string" minOccurs="0" maxOccurs="1" />
                  <xs:element name="title" type="xs:string" minOccurs="0" maxOccurs="1" />
                  <xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1" />
                </xs:all>
                <xs:attribute name="addedby" type="xs:string" />
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="EmailTemplates" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="emailtemplate" minOccurs="0" maxOccurs="unbounded">
              <xs:complexType>
                <xs:all>
                  <xs:element name="templateid" type="GuidType" minOccurs="1" maxOccurs="1" />
                  <xs:element name="subject" type="xs:string" minOccurs="1" maxOccurs="1" />
                  <xs:element name="subjectpresentationxml" type="xs:string" minOccurs="0" maxOccurs="1" />
                  <xs:element name="mimetype" type="xs:string" minOccurs="0" maxOccurs="1" />
                  <xs:element name="templatetypecode" type="xs:nonNegativeInteger" minOccurs="1" maxOccurs="1" />
                  <xs:element name="generationtypecode" type="xs:nonNegativeInteger" minOccurs="0" maxOccurs="1" />
                  <xs:element name="body" type="xs:string" minOccurs="0" maxOccurs="1" />
                  <xs:element name="title" type="xs:string" minOccurs="1" maxOccurs="1" />
                  <xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1" />
                  <xs:element name="presentationxml" type="xs:string" minOccurs="0" maxOccurs="1" />
                  <xs:element name="languagecode" type="xs:nonNegativeInteger" minOccurs="0" maxOccurs="1" />
                </xs:all>
                <xs:attribute name="addedby" type="xs:string" />
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="ContractTemplates" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="contracttemplate" minOccurs="0" maxOccurs="unbounded">
              <xs:complexType>
                <xs:all>
                  <xs:element name="contracttemplateid" type="GuidType" minOccurs="1" maxOccurs="1" />
                  <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1" />
                  <xs:element name="abbreviation" type="xs:string" minOccurs="1" maxOccurs="1" />
                  <xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1" />
                  <xs:element name="contractservicelevelcode" minOccurs="0" maxOccurs="1">
                    <xs:complexType>
                      <xs:simpleContent>
                        <xs:extension base="xs:nonNegativeInteger">
                          <xs:anyAttribute processContents="skip" />
                        </xs:extension>
                      </xs:simpleContent>
                    </xs:complexType>
                  </xs:element>
                  <xs:element name="billingfrequencycode" minOccurs="0" maxOccurs="1">
                    <xs:complexType>
                      <xs:simpleContent>
                        <xs:extension base="xs:nonNegativeInteger">
                          <xs:anyAttribute processContents="skip" />
                        </xs:extension>
                      </xs:simpleContent>
                    </xs:complexType>
                  </xs:element>
                  <xs:element name="allotmenttypecode" minOccurs="0" maxOccurs="1">
                    <xs:complexType>
                      <xs:simpleContent>
                        <xs:extension base="xs:nonNegativeInteger">
                          <xs:anyAttribute processContents="skip" />
                        </xs:extension>
                      </xs:simpleContent>
                    </xs:complexType>
                  </xs:element>
                  <xs:element name="usediscountaspercentage" minOccurs="0" maxOccurs="1">
                    <xs:complexType>
                      <xs:simpleContent>
                        <xs:extension base="xs:nonNegativeInteger">
                          <xs:anyAttribute processContents="skip" />
                        </xs:extension>
                      </xs:simpleContent>
                    </xs:complexType>
                  </xs:element>
                  <xs:element name="effectivitycalendar" type="xs:string" minOccurs="0" maxOccurs="1" />
                </xs:all>
                <xs:attribute name="addedby" type="xs:string" />
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="MailMergeTemplates" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="mailmergetemplate" minOccurs="0" maxOccurs="unbounded">
              <xs:complexType>
                <xs:all>
                  <xs:element name="mailmergetemplateid" type="GuidType" minOccurs="1" maxOccurs="1" />
                  <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1" />
                  <xs:element name="defaultfilter" type="xs:string" minOccurs="0" maxOccurs="1" />
                  <xs:element name="filename" type="xs:string" minOccurs="0" maxOccurs="1" />
                  <xs:element name="parameterxml" type="xs:string" minOccurs="0" maxOccurs="1" />
                  <xs:element name="mimetype" type="xs:string" minOccurs="0" maxOccurs="1" />
                  <xs:element name="templatetypecode" type="xs:nonNegativeInteger" minOccurs="1" maxOccurs="1" />
                  <xs:element name="mailmergetype" type="xs:nonNegativeInteger" minOccurs="0" maxOccurs="1" />
                  <xs:element name="filesize" type="xs:nonNegativeInteger" minOccurs="0" maxOccurs="1" />
                  <xs:element name="documentformat" type="xs:nonNegativeInteger" minOccurs="0" maxOccurs="1" />
                  <xs:element name="languagecode" type="xs:nonNegativeInteger" minOccurs="1" maxOccurs="1" />
                  <xs:element name="body" type="xs:string" minOccurs="0" maxOccurs="1" />
                  <xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1" />
                </xs:all>
                <xs:attribute name="addedby" type="xs:string" />
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="SavedQueriesType">
    <xs:choice maxOccurs="unbounded">
      <xs:element name="savedqueries">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="savedquery" minOccurs="0" maxOccurs="unbounded">
              <xs:complexType>
                <xs:all>
                  <xs:element name="savedqueryid" type="GuidType" minOccurs="1" maxOccurs="1" />
                  <xs:element name="savedqueryidunique" type="GuidType" minOccurs="1" maxOccurs="1" />
                  <xs:element name="queryapi" type="xs:string" minOccurs="0" maxOccurs="1" />
                  <xs:element name="LocalizedNames" type="LocalizedNamesType" minOccurs="1" maxOccurs="1" />
                  <xs:element name="Descriptions" type="DescriptionsType" minOccurs="0" maxOccurs="1" />
                  <xs:element name="iscustomizable" type="SerializedTrueFalse01Type" minOccurs="0" maxOccurs="1" />
                  <xs:element name="isquickfindquery" type="SerializedTrueFalse01Type" minOccurs="0" maxOccurs="1" />
                  <xs:element name="fetchxml" minOccurs="0" maxOccurs="1">
                    <xs:complexType>
                      <xs:sequence>
                        <xs:element name="fetch" type="FetchType" minOccurs="0" maxOccurs="1" />
                      </xs:sequence>
                    </xs:complexType>
                  </xs:element>
                  <xs:element name="isuserdefined" type="SerializedTrueFalse01Type" minOccurs="0" maxOccurs="1" />
                  <xs:element name="isdefault" type="SerializedTrueFalse01Type" minOccurs="0" maxOccurs="1" />
                  <xs:element name="isprivate" type="TrueFalse01Type" minOccurs="0" maxOccurs="1" />
                  <xs:element name="returnedtypecode" type="SerializedInteger" minOccurs="0" maxOccurs="1" />
                  <xs:element name="customizationlevel" minOccurs="1" maxOccurs="1">
                    <xs:complexType>
                      <xs:simpleContent>
                        <xs:extension base="xs:integer">
                          <xs:attribute name="formattedvalue" type="xs:integer" use="required" />
                        </xs:extension>
                      </xs:simpleContent>
                    </xs:complexType>
                  </xs:element>
                  <xs:element name="layoutxml" minOccurs="0" maxOccurs="1">
                    <xs:complexType>
                      <xs:sequence>
                        <xs:element name="grid" minOccurs="0" maxOccurs="1">
                          <xs:complexType>
                            <xs:sequence>
                              <xs:element name="row" minOccurs="0" maxOccurs="unbounded">
                                <xs:complexType>
                                  <xs:sequence>
                                    <xs:element name="cell" minOccurs="0" maxOccurs="unbounded">
                                      <xs:complexType>
                                        <xs:attribute name="name" type="xs:string" />
                                        <xs:attribute name="width" type="xs:nonNegativeInteger" />
                                        <xs:attribute name="disableMetaDataBinding" type="TrueFalse01Type" />
                                        <xs:attribute name="LabelId" type="xs:string" />
                                        <xs:attribute name="ishidden" type="TrueFalse01Type" />
                                        <xs:attribute name="disableSorting" type="TrueFalse01Type" />
                                        <xs:attribute name="addedby" type="xs:string" />
                                        <xs:attribute name="desc" type ="xs:string" />										  
                                      </xs:complexType>
                                    </xs:element>
                                  </xs:sequence>
                                  <xs:attribute name="name" type="xs:string" />
                                  <xs:attribute name="id" type="xs:string" />
                                  <xs:attribute name="multiobjectidfield" type="xs:string" />
                                </xs:complexType>
                              </xs:element>
                            </xs:sequence>
                            <xs:attribute name="name" type="xs:string" />
                            <xs:attribute name="object" type="ObjectTypeCodeType" />
                            <xs:attribute name="jump" type="xs:string" />
                            <xs:attribute name="select" type="TrueFalse01Type" />
                            <xs:attribute name="icon" type="TrueFalse01Type" />
                            <xs:attribute name="preview" type="TrueFalse01Type" />
                          </xs:complexType>
                        </xs:element>
                      </xs:sequence>
                    </xs:complexType>
                  </xs:element>
                  <xs:element name="querytype" type="SerializedInteger" minOccurs="0" maxOccurs="1" />
                  <xs:element name="columnsetxml" minOccurs="0" maxOccurs="1">
                    <xs:complexType>
                      <xs:sequence>
                        <xs:element name="columnset" minOccurs="0" maxOccurs="1">
                          <xs:complexType>
                            <xs:choice minOccurs="0" maxOccurs="unbounded">
                              <xs:element name="ascend" type="xs:string" minOccurs="0" />
                              <xs:element name="descend" type="xs:string" minOccurs="0" />
                              <xs:element name="column" minOccurs="0" maxOccurs="unbounded">
                                <xs:complexType>
                                  <xs:simpleContent>
                                    <xs:extension base="xs:string">
                                      <xs:attribute name="addedby" type="xs:string" />
                                    </xs:extension>
                                  </xs:simpleContent>
                                </xs:complexType>
                              </xs:element>
                              <xs:element ref="filter" minOccurs="0" maxOccurs="unbounded" />
                            </xs:choice>
                            <xs:attribute name="version" type="xs:string" />
                            <xs:attribute name="distinct" type="xs:boolean" />
                          </xs:complexType>
                        </xs:element>
                      </xs:sequence>
                    </xs:complexType>
                  </xs:element>
                </xs:all>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
          <xs:attribute name="entity" type="xs:string" />
          <xs:attribute name="morerecords" type="xs:string" />
          <xs:attribute name="paging-cookie" type="xs:string" />
          <xs:attribute name="version" type="xs:string" />
        </xs:complexType>
      </xs:element>
    </xs:choice>
  </xs:complexType>
  <xs:complexType name="FetchType">
    <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:element name="entity" type="FetchEntityType" />
    </xs:choice>
    <xs:attribute name="version"></xs:attribute>
    <xs:attribute name="count" type="xs:integer"></xs:attribute>
    <xs:attribute name="page" type="xs:integer"></xs:attribute>
    <xs:attribute name="utc-offset" type="xs:integer"></xs:attribute>
    <xs:attribute name="aggregate" type="xs:boolean"></xs:attribute>
    <xs:attribute name="mapping">
      <xs:simpleType>
        <xs:restriction base="xs:NMTOKEN">
          <xs:enumeration value="internal" />
          <xs:enumeration value="logical" />
          <xs:enumeration value="physical" />
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="output-format">
      <xs:simpleType>
        <xs:restriction base="xs:NMTOKEN">
          <xs:enumeration value="xml-ado" />
          <xs:enumeration value="xml-auto" />
          <xs:enumeration value="xml-elements" />
          <xs:enumeration value="xml-raw" />
          <xs:enumeration value="xml-platform" />
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="distinct" type="xs:boolean" />
  </xs:complexType>
  <xs:complexType name="FetchEntityType">
    <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:element name="all-attributes" minOccurs="0" />
      <xs:element name="attribute" type="FetchAttributeType" minOccurs="0" maxOccurs="unbounded" />
      <xs:element name="order" type="FetchOrderType" minOccurs="0" maxOccurs="unbounded" />
      <xs:element name="link-entity" type="FetchLinkEntityType" />
      <xs:element ref="filter" minOccurs="0" />
    </xs:choice>
    <xs:attribute name="name" use="required" type="xs:string"></xs:attribute>
  </xs:complexType>
  <xs:element name="filter">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="condition" minOccurs="0" maxOccurs="unbounded">
          <xs:complexType>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
              <xs:element name="value" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                  <xs:simpleContent>
                    <xs:extension base="xs:string">
                      <xs:attribute name="uiname" type="xs:string" />
                      <xs:attribute name="uitype" type="xs:string" />
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
              </xs:element>
            </xs:choice>
            <xs:attribute name="column" type="xs:string" />
            <xs:attribute name="attribute" type="xs:string" />
            <xs:attribute name="operator" use="required">
              <xs:simpleType>
                <xs:restriction base="xs:NMTOKEN">
                  <xs:enumeration value="eq" />
                  <xs:enumeration value="neq" />
                  <xs:enumeration value="ne" />
                  <xs:enumeration value="gt" />
                  <xs:enumeration value="ge" />
                  <xs:enumeration value="le" />
                  <xs:enumeration value="lt" />
                  <xs:enumeration value="like" />
                  <xs:enumeration value="not-like" />
                  <xs:enumeration value="in" />
                  <xs:enumeration value="not-in" />
                  <xs:enumeration value="between" />
                  <xs:enumeration value="not-between" />
                  <xs:enumeration value="null" />
                  <xs:enumeration value="not-null" />
                  <xs:enumeration value="yesterday" />
                  <xs:enumeration value="today" />
                  <xs:enumeration value="tomorrow" />
                  <xs:enumeration value="last-seven-days" />
                  <xs:enumeration value="next-seven-days" />
                  <xs:enumeration value="last-week" />
                  <xs:enumeration value="this-week" />
                  <xs:enumeration value="next-week" />
                  <xs:enumeration value="last-month" />
                  <xs:enumeration value="this-month" />
                  <xs:enumeration value="next-month" />
                  <xs:enumeration value="on" />
                  <xs:enumeration value="on-or-before" />
                  <xs:enumeration value="on-or-after" />
                  <xs:enumeration value="last-year" />
                  <xs:enumeration value="this-year" />
                  <xs:enumeration value="next-year" />
                  <xs:enumeration value="last-x-hours" />
                  <xs:enumeration value="next-x-hours" />
                  <xs:enumeration value="last-x-days" />
                  <xs:enumeration value="next-x-days" />
                  <xs:enumeration value="last-x-weeks" />
                  <xs:enumeration value="next-x-weeks" />
                  <xs:enumeration value="last-x-months" />
                  <xs:enumeration value="next-x-months" />
                  <xs:enumeration value="olderthan-x-months" />
                  <xs:enumeration value="last-x-years" />
                  <xs:enumeration value="next-x-years" />
                  <xs:enumeration value="eq-userid" />
                  <xs:enumeration value="ne-userid" />
                  <xs:enumeration value="eq-businessid" />
                  <xs:enumeration value="ne-businessid" />
                  <xs:enumeration value="eq-userlanguage" />
                </xs:restriction>
              </xs:simpleType>
            </xs:attribute>
            <xs:attribute name="value" type="xs:string"></xs:attribute>
            <xs:attribute name="aggregate">
              <xs:simpleType>
                <xs:restriction base="xs:NMTOKEN">
                  <xs:enumeration value="count" />
                  <xs:enumeration value="average" />
                  <xs:enumeration value="sum" />
                  <xs:enumeration value="stdev" />
                </xs:restriction>
              </xs:simpleType>
            </xs:attribute>
            <xs:attribute name="alias" type="xs:string" />
            <xs:attribute name="uiname" />
            <xs:attribute name="uitype" />
          </xs:complexType>
        </xs:element>
        <xs:element ref="filter" minOccurs="0" maxOccurs="unbounded" />
      </xs:choice>
      <xs:attribute name="type" default="and">
        <xs:simpleType>
          <xs:restriction base="xs:NMTOKEN">
            <xs:enumeration value="and" />
            <xs:enumeration value="or" />
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="isquickfindfields" type="TrueFalse01Type" />
    </xs:complexType>
  </xs:element>
  <xs:complexType name="FetchAttributeType">
    <xs:attribute name="name" use="required" type="xs:string"></xs:attribute>
    <xs:attribute name="addedby" type="xs:string" />
  </xs:complexType>
  <xs:complexType name="FetchOrderType">
    <xs:choice minOccurs="0" maxOccurs="unbounded" />
    <xs:attribute name="attribute" use="required" type="xs:string"></xs:attribute>
    <xs:attribute name="descending" default="false" type="xs:boolean"></xs:attribute>
  </xs:complexType>
  <xs:complexType name="FetchLinkEntityType">
    <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:element name="all-attributes" minOccurs="0" />
      <xs:element name="attribute" type="FetchAttributeType" minOccurs="0" maxOccurs="unbounded" />
      <xs:element name="order" type="FetchOrderType" minOccurs="0" maxOccurs="unbounded" />
      <xs:element ref="filter" minOccurs="0" />
      <xs:element name="link-entity" type="FetchLinkEntityType" />
    </xs:choice>
    <xs:attribute name="name" use="required" type="xs:string"></xs:attribute>
    <xs:attribute name="from" type="xs:string"></xs:attribute>
    <xs:attribute name="to" type="xs:string"></xs:attribute>
    <xs:attribute name="alias" type="xs:string"></xs:attribute>
    <xs:attribute name="intersect" type="xs:boolean"></xs:attribute>
    <xs:attribute name="visible" type="xs:boolean"></xs:attribute>
    <xs:attribute name="link-type" type="xs:string"></xs:attribute>
  </xs:complexType>
  <xs:complexType name="IgnoredType">
    <xs:sequence>
      <xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>
</xs:schema>